package com.smart.six.editor.javabean;

import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;

/**
 * ChartBean对应的BeanInfo
 *
 * @author junrui.wang
 * @create 2018/7/5
 */
public class ChartBeanBeanInfo extends SimpleBeanInfo {

    //将属性和属性编辑器联系起来
    public PropertyDescriptor[] getPropertyDescriptors() {
        try {
            PropertyDescriptor titlePositionDescriptor =
                    new PropertyDescriptor("titlePosition", ChartBean.class);
            //将TitlePositionEditor绑定到ChartBean的titlePosition属性中
            titlePositionDescriptor.setPropertyEditorClass(TitlePositionEditor.class);

            return new PropertyDescriptor[]{titlePositionDescriptor};

        } catch (IntrospectionException e) {
            e.printStackTrace();
            return null;
        }
    }
}
